<template>ww
  <el-date-picker
    ref="domDate"
    v-model="value"
    v-bind="$attrs"
    type="dates"
    :name="'c' + meta.columnId"
    :format="format"
    :value-format="valueFormat"
    :clearable="clearable"
  >
  </el-date-picker>
</template>

<script setup lang="ts" generic="T extends object">
  /**
   * 年月日
   */
  import type { IFormItemProps } from '../../map'
  import { itemController } from '../../map'

  defineOptions({
    name: 'nf-el-from-item-date-more',
    inheritAttrs: false,
  })

  const ff = 'YYYY-MM'
  
  const props = withDefaults(defineProps<IFormItemProps<T> & {
    format?: string,
    valueFormat?: string,
  }>(), {
    meta: () => {
      return {
        colName: ''
      }
    },
    model: () => {
      return {} as T
    },
    clearable: true,
    format: ff,
    valueFormat: 'YYYY-MM-DD'
  })
 
  const { value } = itemController(props )
  
  if (!Array.isArray(value.value)) {
    value.value = []
  }
 
</script>
